<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
         .parent{
             float: left;
             position: relative;

         }
        .son{
            position: absolute;
            left: 0;
            top: 20px;
            width: 120px;
        }
    </style>
</head>
<body>
<div class="parent" onclick="test(this)">
    <div>我是父级</div>
    <div class="son" style="display: none">
        <div>我是子级菜单1</div>
        <div>我是子级菜单2</div>
    </div>
</div>
<div   class="parent" onclick="test(this)">
    <div>我是父级</div>
    <div class="son" style="display: none">
        <div>我是子级菜单1</div>
        <div>我是子级菜单2</div>
    </div>
</div>
<div  class="parent" onclick="test(this)">
    <div>我是父级</div>
    <div class="son"  style="display: none">
        <div>我是子级菜单1</div>
        <div>我是子级菜单2</div>
    </div>
</div>
<script>
     function test(This) {
         var parent=document.getElementsByClassName('parent');
           for(var i=0;i<parent.length;i++){
               parent[i].children[1].style.display='none'
           }
         if(This.children[1].style.display=='block'){
             This.children[1].style.display='none'
         }else {
             This.children[1].style.display = 'block';
         }
     }
     let arr=[
         {id:1,am:2}
     ]
     if(arr[0].c){
         console.log(1);
     }else{
         console.log(2);
     }
</script>
</body>
</html>